package com.name.givename.serviceimpl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.name.givename.dao.UserNamedInfoEntityMapper;
import com.name.givename.dto.NameListDTO;
import com.name.givename.entity.UserNamedInfoEntity;
import com.name.givename.param.ExamineNameParams;
import com.name.givename.param.PageParams;
import com.name.givename.param.UserNameInfoParams;
import com.name.givename.service.UserNameInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserNameInfoServiceImpl implements UserNameInfoService {

    @Autowired private UserNamedInfoEntityMapper userNamedInfoEntityMapper;

    /**
     * 获取所有的起名信息列表
     * @param pageParams
     * @return
     */
    @Override
    public Page<NameListDTO> getUserNameInfo(PageParams pageParams) {
        return (Page<NameListDTO>) userNamedInfoEntityMapper.getNameListInfo();
    }

    @Override
    public List<UserNamedInfoEntity> getUserNameInfoByIdOrName(String giveName) {
        return userNamedInfoEntityMapper.getUserNameInfoByIdOrName(giveName);
    }

    @Override
    public Page<NameListDTO> getUserNames() {
        return userNamedInfoEntityMapper.getUserNames();
    }

    @Override
    public void updateNameStatus(ExamineNameParams examineNameParams) {
        userNamedInfoEntityMapper.updateNameStatus(examineNameParams);
    }
}
